<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component"
      xmlns:composite="http://java.sun.com/jsf/composite">
    <composite:interface>
        <!--        <composite:attribute name="sidDadosTabela"
                                     type="java.lang.String"
                                     default="DadosTabela"
                                     shortDescription='"ID" Tabela Dados'/>-->
        <composite:attribute name="bean"
                             required="true"
                             shortDescription="Bean"/>
        <composite:attribute name="tituloCad"
                             required="false"
                             default="Cadastro"
                             shortDescription="Titulo tabela cadastro"/>
        <composite:attribute name="onSelectRow"
                             required="false"
                             shortDescription="Metodo a chamar ao selecionar Linha"/>
        <composite:attribute name="tabelaConfig"
                             required="true"
                             shortDescription="
                             tabelaConfig.sidDadosTabela
                             tabelaConfig.qtdPaginas
                             tabelaConfig.listaRegistros
                             registroLista[coluna.snmCampoColuna]
                             tabelaConfig.colunasTabela
                             coluna.labelColuna

                             tabelaConfig[rowSelectionListener]
                             tabelaConfig[metodoAlterar]
                             tabelaConfig[metodoExcluir]
                             "/>
        <composite:attribute name="novo"
                             required="false"
                             shortDescription="Metodo a chamar ao clicar em Novo"
                             default="novo"/>
        <composite:attribute name="salvar"
                             required="false"
                             shortDescription="Metodo a chamar ao clicar em Salvar"
                             default="salvar"/>
        <composite:attribute name="excluir"
                             required="false"
                             shortDescription="Metodo a chamar ao clicar em Excluir"
                             default="excluir"/>
        <composite:attribute name="cancelar"
                             required="false"
                             shortDescription="Metodo a chamar ao clicar em Cancelar"
                             default="cancelar"/>
    </composite:interface>
    <composite:implementation>
        <ice:form>    <!--#{cc.attrs.idform}-->
<!--            <ice:outputText value="#{cc.attrs.bean}"/>
            <ice:outputText value="#{cc.attrs.bean[rowSelectionListener]}"/>            
            <ice:outputText value="#{cc.attrs.bean.rowSelectionListener}"/>-->
            <ice:panelGrid columns="1">

                <ice:panelGrid columns="2" style="width: 100%;">
                    <ice:commandButton image="#{facesContext.externalContext.requestContextPath}/images/novo.png" actionListener="${cc.attrs.bean[cc.attrs.novo]}"/>
                    <ice:dataPaginator for="#{cc.attrs.tabelaConfig.sidDadosTabela}" paginator="true"  paginatorMaxPages="#{cc.attrs.tabelaConfig.qtdPaginas}"
                                       fastStep="2" style="float:right;">
                        <f:facet name="first">
                            <ice:graphicImage
                                url="/css/images/arrow-first.gif"
                                style="border:none;"
                                title="#{mLbl['label.primeiraPagina']}"/>
                        </f:facet>
                        <f:facet name="last">
                            <ice:graphicImage
                                styleClass="navagacaoFirst"
                                url="/css/images/arrow-last.gif"
                                style="border:none;"
                                title="#{mLbl['label.ultimaPagina']}"/>
                        </f:facet>
                        <f:facet name="fastforward">
                            <ice:graphicImage
                                url="/css/images/arrow-ff.gif"
                                style="border:none;"
                                title="#{mLbl['label.paginaSeguinte']}"/>
                        </f:facet>
                        <f:facet name="fastrewind">
                            <ice:graphicImage
                                url="/css/images/arrow-fr.gif"
                                style="border:none;"
                                title="#{mLbl['label.paginaAnterior']}"/>
                        </f:facet>
                    </ice:dataPaginator>
                </ice:panelGrid>
                <ice:dataTable id="#{cc.attrs.tabelaConfig.sidDadosTabela}" value="#{cc.attrs.tabelaConfig.listaRegistros}" var="registroLista" rows="10" headerClass="dadosTabelaHead" styleClass="dadosTabelaClass" rowClasses="dadosTabelaRow">
                    <ice:columns value="#{cc.attrs.tabelaConfig.colunasTabela}" var="coluna">
                        <ice:rowSelector id="selected" value="false" multiple="false" enhancedMultiple="false" selectionListener="#{cc.attrs.bean[cc.attrs.onSelectRow]}"/>
                        <f:facet name="header">
                            <ice:outputText value="#{coluna.labelColuna}"/>                        
                        </f:facet>
                        <ice:outputText value="#{registroLista[coluna.snmCampoColuna]}"/>
                    </ice:columns>                
                    <!--                <f:facet name="header">
                                        <ice:outputText value="Ação"/>
                                    </f:facet>-->
                    <!--                <ice:panelGrid columns="3">
                                        <ice:commandButton image="/css/images/editar.png" action="#{cc.attrs.tabelaConfig[metodoAlterar]}"/>
                                        <ice:outputText style="width:10px"/>
                                        <ice:commandButton image="/css/images/delete.png" action="#{cc.attrs.tabelaConfig[metodoExcluir]}"/>
                                    </ice:panelGrid>-->
                </ice:dataTable>
            </ice:panelGrid>
    <!--            <ice:panelGrid columns="2">
                    <ice:outputText value="cc.attrs.salvar"/>
                    <ice:outputText value="#{cc.attrs.salvar}"/>
                    <ice:outputText value="cc.attrs.tabelaConfig"/>
                    <ice:outputText value="#{cc.attrs.tabelaConfig}"/>
                    <ice:outputText value="cc.attrs.tabelaConfig.visablePopupCad"/>
                    <ice:outputText value="${cc.attrs.tabelaConfig.visablePopupCad}"/>
                    <ice:outputText value="cc.attrs.tabelaConfig"/>
                    <ice:outputText value="${cc.attrs.tabelaConfig}"/>
                </ice:panelGrid>-->
            <ice:panelPopup draggable="false" modal="true" visible="#{cc.attrs.tabelaConfig.visablePopupCad}" rendered="#{cc.attrs.tabelaConfig.visablePopupCad}" autoCentre="true">
                <f:facet name="body">
                    <ice:panelGrid cellpadding="0" cellspacing="0" styleClass="bodyPopupCad" headerClass="headPopupCad" footerClass="footPopupCad" columns="1">
                        <f:facet name="header">
                            <ice:panelGroup>
                                <ice:outputText value="#{cc.attrs.tituloCad}"/>
                            </ice:panelGroup>
                        </f:facet>
                        <ice:panelGrid columns="4" styleClass="toolbarCad" columnClasses="nothing,nothing,width100,nothing">
                            <ice:commandButton actionListener="${cc.attrs.bean[cc.attrs.salvar]}" styleClass="buttonsCad buttonSave" title="#{mLbl['botao.salvar']}"/>
                            <ice:commandButton actionListener="${cc.attrs.bean[cc.attrs.excluir]}" styleClass="buttonsCad buttonExcluir" rendered="#{!cc.attrs.bean['tabelaConfigPricipalCad']['novoReg']}" title="#{mLbl['botao.excluir']}"/>
                            <ice:panelGroup/>
                            <ice:commandButton actionListener="#{cc.attrs.bean[cc.attrs.cancelar]}" styleClass="buttonsCad buttonCancelar" title="#{mLbl['botao.cancelar']}"/>
                        </ice:panelGrid>
                        <ice:panelSeries var="campo" value="#{cc.attrs.tabelaConfig.camposTabelaCad}">
                            <ice:panelGrid columns="2" columnClasses="labelCampoCad">
                                <ice:outputText value="${campo.labelCampo}"/>
<!--                            <ice:outputText value="*" style="color: red;" rendered="${campo.requerido}"/>-->
                                
                                <ice:inputText value="#{cc.attrs.tabelaConfig.selected[campo.snmCampo]}" required="${campo.requerido}" maxlength="${campo.length > -1?campo.length:50}"></ice:inputText>
                            </ice:panelGrid>
                        </ice:panelSeries>
                    </ice:panelGrid>
                </f:facet>
            </ice:panelPopup>
        </ice:form>
    </composite:implementation>
</html>
